<template>
  <div class="container">
    <div class="user-page">
      <ul class="list">
        <li class="item" @click="router('userInfo')">
          <div class="icon">
            <img class="image" src="/static/images/icon/per-info.png" alt="">
          </div>
          <div class="content">个人信息</div>
        </li>
        <li class="item" @click="router('company')">
          <div class="icon">
            <img class="image" src="/static/images/icon/company.png" alt="">
          </div>
          <div class="content">公司信息</div>
        </li>
        <li class="item" @click="router('career')">
          <div class="icon">
            <img class="image" src="/static/images/icon/career.png" alt="">
          </div>
          <div class="content">事业风采</div>
        </li>
        <li class="item" @click="router('honor')">
          <div class="icon">
            <img class="image" src="/static/images/icon/honor.png" alt="">
          </div>
          <div class="content">公司荣誉</div>
        </li>
        <li class="item" @click="router('cardCode')">
          <div class="icon">
            <img class="image" src="/static/images/icon/wechat-code.png" alt="">
          </div>
          <div class="content">我的名片码</div>
        </li>
        <li class="item" @click="handleIsVip('cardStyle')">
          <div class="icon">
            <img class="image" src="/static/images/icon/cards.png" alt="">
          </div>
          <div class="content">名片风格</div>
        </li>
        <li class="item" @click="handleIsVip('music')">
          <div class="icon">
            <img class="image" src="/static/images/icon/bgm.png" alt="">
          </div>
          <div class="content">背景音乐</div>
        </li>
      </ul>
      <ul class="list">
        <li class="item" @click="handleIsVip('near')">
          <div class="icon">
            <img class="image" src="/static/images/icon/near.png" alt="">
          </div>
          <div class="content">附近的人</div>
        </li>
        <li class="item" @click="handleIsVip('visitor')">
          <div class="icon">
            <img class="image" src="/static/images/icon/visitor.png" alt="">
          </div>
          <div class="content">访客数据</div>
        </li>
        <li class="item" @click="handleIsVip('favorites')">
          <div class="icon">
            <img class="image" src="/static/images/icon/favorites.png" alt="">
          </div>
          <div class="content">收藏名片</div>
        </li>
        <li class="item" @click="router('friends')">
          <div class="icon">
            <img class="image" src="/static/images/icon/card-circle.png" alt="">
          </div>
          <div class="content">人脉圈</div>
        </li>
        <li class="item" @click="handleIsVip('takeCash')">
          <div class="icon">
            <img class="image" src="/static/images/icon/take.png" alt="">
          </div>
          <div class="content">提现</div>
        </li>
      </ul>
      <ul class="list">
        <navigator class="item" target="miniProgram" open-type="navigate" app-id="wx2dd21271f042ec70" path="pages/index/main" extra-data="" version="release">
        <!-- <li class="item" > -->
          <div class="icon">
            <img class="image" src="/static/images/icon/health.png" alt="">
          </div>
          <div class="content">体质测试</div>
        <!-- </li> -->
        </navigator>
        <navigator class="item" target="miniProgram" open-type="navigate" app-id="wx01b1b3205eb88167" path="pages/index/index" extra-data="" version="release">
        <!-- <li class="item" > -->
          <div class="icon">
            <img class="image" src="/static/images/icon/care.png" alt="">
          </div>
          <div class="content">健养平台</div>
        <!-- </li> -->
        </navigator>
      </ul>
    </div>
    <vFooter></vFooter>
  </div>
</template>

<script>
import vFooter from '@/components/footer.vue'
import vModal from '@/components/modal.vue'

export default {
  data () {
    return {
    }
  },

  onShareAppMessage (res) {
    let self = this;
    let url = `${self.$confs.shareUrl}?id=${self.userInfo.id}`;
    return {
      title: self.$confs.shareTitle,
      path: url,
    }
  },

  components: {
    vFooter,
    vModal,
  },

  computed: {
    userInfo () {
      return this.$store.state.userInfo;
    },
    isVip () {
      return this.$store.state.isVip;
    },
  },

  onShow(e){
    this.$store.dispatch('getCurrentUrl', 'user');
  },

  methods: {
    router (route) {
      let url = `/pages/${route}/main`;
      wx.navigateTo({url});
    },
    handleIsVip (route) {
      if (this.isVip) {
        this.router(route);
      }
      else {
        this.$modal.show({
          title: '请开通会员！',
          content: '您尚未开通会员，开通会员更多功能即可使用',
          confirmText: '开通会员',
          success: (res) => {
            if (res.confirm) {
              this.router('openVip');
            }
          },
        });
      }
    },
    // jump (id) {
    //   let path = 'pages/index/index';
    //   if (id === 'wx2dd21271f042ec70') {
    //     path = 'pages/index/main';
    //   }
    //   wx.navigateToMiniProgram({
    //     appId: id,
    //     path: path,
    //   })
    // },
  },

  mounted () {
  }
}
</script>

<style lang="scss">
@import './index.scss';
</style>
